home *** CD-ROM | disk | FTP | other *** search
/ Revista CD Expert 37 / CD Expert nº 37.iso / LastCall / lastcall.exe / stuff / lastcall.dxr / 00120_Bonus Patron.ls < prev    next >
Encoding:
Text File  |  2000-03-27  |  4.8 KB  |  196 lines

  1. property pSpr, pOrigMember, pBarPosition, pCharCode, pStatus, pMouthSprite, pOrigLocH, pIngredient, pArrived, pCharList, pIngredientNum, pBonusPatience, pBonusPoints, pFirstTime
  2. global gWrongAnswers, gRightAnswers, gSoundFX2chan
  3.  
  4. on endSprite
  5.   pSpr.visible = 1
  6. end
  7.  
  8. on beginSprite me
  9.   global gImplementedCharacters, gPauseTime
  10.   pStatus = #new
  11.   pCharList = []
  12.   repeat with Y = 1 to count(gImplementedCharacters)
  13.     add(pCharList, getPropAt(gImplementedCharacters, Y))
  14.   end repeat
  15.   pSpr = sprite(me.spriteNum)
  16.   pOrigLocH = pSpr.locH
  17.   pMouthSprite = sprite(me.spriteNum + 1)
  18.   pMouthSprite.locH = 5000
  19.   pSpr.locH = 5000
  20.   pSpr.visible = 0
  21.   pFirstTime = 1
  22.   pBonusPatience = currentLevel(#BONUSPATIENCE)
  23.   pBonusPoints = currentLevel(#BONUSTIPSPERCORRECTANSWER)
  24.   pCharCode = VOID
  25. end
  26.  
  27. on mAppear me, waitFor
  28.   global gBonusCharacters, gGameLevel
  29.   pStatus = #appear
  30.   pSpr.locH = pOrigLocH
  31.   conflict = 1
  32.   repeat while conflict = 1
  33.     newChar = randomFromList(pCharList)
  34.     conflict = 0
  35.     repeat with X in gBonusCharacters
  36.       if sprite(X).pCharCode = newChar then
  37.         conflict = 1
  38.       end if
  39.     end repeat
  40.   end repeat
  41.   pCharCode = newChar
  42.   pIngredientNum = random(50)
  43.   pIngredient = findingredientbyid(pIngredientNum)
  44.   repeat while ((gGameLevel = 1) and getXbottleness(pIngredient)) or badIngredient(me)
  45.     pIngredientNum = random(50)
  46.     pIngredient = findingredientbyid(pIngredientNum)
  47.   end repeat
  48.   pOrigMember = member(pCharCode & "_B", "bonusch")
  49.   pMouthSprite.member = member(pCharCode & "_C", "bonusch")
  50.   pSpr.visible = 1
  51.   pSpr.member = pOrigMember
  52.   playBonusSound(gSoundFX2chan, "BRA_X01")
  53. end
  54.  
  55. on badIngredient me
  56.   global gExcludeBonusList
  57.   return getOne(gExcludeBonusList, pIngredient) or (pIngredientNum = 34)
  58. end
  59.  
  60. on order me
  61.   pStatus = #ordered
  62.   playDrink(me, pIngredientNum)
  63. end
  64.  
  65. on exitFrame me
  66.   if pFirstTime = 1 then
  67.     pFirstTime = 2
  68.     exit
  69.   else
  70.     if pFirstTime = 2 then
  71.       pArrived = now() + (seconds(currentLevel(#BONUSSPACING)) * (pBarPosition - 1))
  72.       pFirstTime = 0
  73.     end if
  74.   end if
  75.   if inMenuMode() then
  76.     exit
  77.   end if
  78.   if soundBusy(pBarPosition) then
  79.     pMouthSprite.locH = pSpr.locH
  80.   else
  81.     pMouthSprite.locH = 5000
  82.   end if
  83.   if inSlotMode() then
  84.     if (timeHere(me) > 0) and (pStatus = #slots) then
  85.       playBonusSound(gSoundFX2chan, "BRA_X01")
  86.       pSpr.visible = 1
  87.       pArrived = now()
  88.       pStatus = #onStage
  89.     else
  90.       if (timeHere(me) > 0) and (pStatus = #onStage) then
  91.         order(me)
  92.         pStatus = #done
  93.       end if
  94.     end if
  95.     exit
  96.   end if
  97.   if (timeHere(me) > 0) and (pStatus = #new) then
  98.     mAppear(me)
  99.   else
  100.     if (timeHere(me) > 90) and (pStatus = #offStage) then
  101.       mAppear(me)
  102.     else
  103.       if (timeHere(me) > seconds(pBonusPatience)) and (pStatus = #ordered) then
  104.         mLeave(me, 1)
  105.       else
  106.         if (timeHere(me) > 30) and (pStatus = #appear) then
  107.           repeat with X = 1 to 3
  108.             if soundBusy(X) then
  109.               exit
  110.             end if
  111.           end repeat
  112.           order(me)
  113.         end if
  114.       end if
  115.     end if
  116.   end if
  117. end
  118.  
  119. on timeHere me
  120.   return elapsedTime(pArrived)
  121. end
  122.  
  123. on mLeave me, loud
  124.   if loud then
  125.     playBonusSound(pBarPosition, "BRA_X02")
  126.   end if
  127.   pSpr.locH = 5000
  128.   pArrived = now()
  129.   pStatus = #offStage
  130.   pCharCode = VOID
  131.   pIngredientNum = 0
  132. end
  133.  
  134. on mouseUp me
  135.   if pIngredient = 0 then
  136.     exit
  137.   else
  138.     mDropIngredient(me)
  139.   end if
  140. end
  141.  
  142. on mDropIngredient me
  143.   global gLastIngredient
  144.   if gLastIngredient <> pIngredient then
  145.     playDrink(me, pIngredientNum)
  146.     if gLastIngredient <> 0 then
  147.       gWrongAnswers = gWrongAnswers + 1
  148.     end if
  149.     return 0
  150.   end if
  151.   gRightAnswers = gRightAnswers + 1
  152.   gLastIngredient = 0
  153.   pMouthSprite.locH = 5000
  154.   playBonusSound(pBarPosition, "BRA_X06")
  155.   pSpr.member = member(pCharCode & "_D", "bonusch")
  156.   updateStage()
  157.   replaceDraggingAnything()
  158.   playBonusSound(pBarPosition, "BRA_X07")
  159.   regTip(pBonusPoints, 1)
  160.   mLeave(me)
  161.   return 1
  162. end
  163.  
  164. on toughLove me
  165.   mLeave(me)
  166.   pArrived = now() + (seconds(currentLevel(#BONUSSPACING)) * (pBarPosition - 1))
  167. end
  168.  
  169. on getPropertyDescriptionList me
  170.   return [#pBarPosition: [#default: 1, #format: #integer, #range: [1, 2, 3], #comment: "BarSlot"]]
  171. end
  172.  
  173. on playDrink me, ingredientNum
  174.   ing = string(ingredientNum)
  175.   if length(ing) < 2 then
  176.     put "0" before ing
  177.   end if
  178.   pMouthSprite.locH = pSpr.locH
  179.   updateStage()
  180.   playBonusSound(pBarPosition, "BRA_I" & ing)
  181. end
  182.  
  183. on slots me
  184.   pSpr.visible = 0
  185.   pMouthSprite.locH = 5000
  186.   pStatus = #slots
  187.   pSpr.locH = pOrigLocH
  188.   pCharCode = randomFromList(pCharList)
  189.   pIngredientNum = randomFromList([35, 36, 37, 38, 39, 40, 41])
  190.   pIngredient = findingredientbyid(pIngredientNum)
  191.   pOrigMember = member(pCharCode & "_B", "bonusch")
  192.   pMouthSprite.member = member(pCharCode & "_C", "bonusch")
  193.   pSpr.member = pOrigMember
  194.   pArrived = now() + seconds(0.5) + (seconds(1.5) * (pBarPosition - 1))
  195. end
  196.